package com.pn.controller;

import com.pn.entity.InStore;
import com.pn.entity.Result;
import com.pn.page.Page;
import com.pn.service.InStoreService;
import com.pn.service.StoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/instore")
@RestController
public class InStoreController {

    @Autowired
    private InStoreService inStoreService;
    @Autowired
    private StoreService storeService;

    /*查询仓库列表url接口/instore/store-list*/
    @RequestMapping("/store-list")
    public Result getStore() {
        return Result.ok(storeService.queryAllStore());
    }

    /*分页查询入库单url接口/instore-page-list*/
    @RequestMapping("/instore-page-list")
    public Result queryInstorePage(Page page, InStore inStore) {
        page = inStoreService.queryInstorePage(page, inStore);
        return Result.ok(page);
    }

    /*确认入库url接口instore/instore-confirm*/
    @RequestMapping("/instore-confirm")
    public Result instoreConfirm(@RequestBody InStore inStore){
        return inStoreService.setIsInById(inStore);
    }

}
